const Sequelize = require("sequelize");
const db = {};

const sequelize = new Sequelize('ticket-platform', 'ticket-platform', 'zhoupeng0abc', {
  host: '113.45.130.158',
  dialect: 'mysql',
  pool: {
    max: 5,
    min: 0,
    acquire: 3000,
    idle: 10000,
  },
  logging: false, 
});

// 同步数据库模型
sequelize.sync({ alter: true })
  .then(() => {
    console.log('数据库表结构已同步');
  })
  .catch((error) => {
    console.error('同步数据库表结构时出错:', error);
  });

db.sequelize = sequelize;


module.exports = db;